import Vue from 'vue'
import Router from 'vue-router'


Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'

/* Router */
import component from './components'

export const constantRouterMap = [
  { path: '/login', component: () => import('@/views/login/login'), hidden: true },
  //业务组件
  {
    path: '/home',
    component: Layout,
    redirect: '/table',
    name: 'index',
    meta: {
      title: '主页',
      icon: 'nested'
    },
    children: [
      {
        path: 'index',
        component: () => import('@/views/home/index'),
        name: 'index',
        meta: { title: '主页' }
      },
    ]
  },
  ...component,

  {
    path: '/nested',
    component: Layout,
    // redirect: '/nested/write',
    name: 'Nested',
    meta: {
      title: '一些用到过的需求',
      icon: 'nested'
    },
    children: [
      {
        path: 'write',
        component: () => import('@/views/demo/write'),
        name: 'write',
        meta: { title: '标点' }
      },
      {
        path: 'Answer',
        component: () => import('@/views/demo/Answer'),
        name: 'Answer',
        meta: { title: '显示' }
      },
      {
        path:'uploads',
        component: () => import('@/views/demo/upload'),
        name: 'uploads',
        meta: { title: '练习' }
      }
    ]
  }
]

export default new Router({
  // mode: 'history', //后端支持可开/
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
